package com.qingcheng.controller.goods;


import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.service.goods.StockBackService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.Schedules;
import org.springframework.stereotype.Component;

/**
 * 定时任务
 */
@Component
@Slf4j
public class SkuTask {

    @Reference
    private StockBackService stockBackService;

    /**
     * 间隔一个小时执行库存回滚
     */
    @Scheduled(cron="0 * * * * ?")
    public void skuStockBack(){
         log.info("库存回滚开始");
        stockBackService.doBack();
        log.info("库存回滚结束");
    }
}
